/*
 * divisor_multiple.c  acquire two unsigned int type data
 * greatest common divisor and least common multiple.
*/

#include <stdio.h>

int main(int argc, char *argv[])
{
	unsigned int a, b;
	unsigned int temp;
	unsigned int divisor;
	unsigned int multiple;
	unsigned int remainder;

	while(1) {
		printf("please input two unsigned int type data\n");
		scanf("%d,%d", &a, &b);

		if (a < b) {
			temp = a;
			a = b;
			b = temp;
		}

		multiple = a * b;
		
		remainder = 1; /* no sense except step into while()*/
		while(remainder != 0) {
			remainder = a % b;
			a  = b ;
			b = remainder;
		}
		
		divisor = a;
		printf("the greaster divisor is %d\n", divisor);
		
		multiple /= divisor;
		printf("the least multiple is %d\n", multiple);
	}
	
	return 0;
}
